//
//  CXLOneTableViewCell.m
//  WYNews
//
//  Created by 夜猫子 on 2017/3/19.
//  Copyright © 2017年 夜猫子. All rights reserved.
//

#import "CXLOneTableViewCell.h"
#import "CZAdditions.h"

@interface CXLOneTableViewCell ()

@property (nonatomic, weak) UILabel *titleLabel;

@property (nonatomic, weak) UIImageView *imgsrcImage;



@end

@implementation CXLOneTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    
    UIImageView *imgsrcImage = [[UIImageView alloc]init];
    [self.contentView addSubview:imgsrcImage];
    
    UILabel *titleLabel = [UILabel cz_labelWithText:@"hahaha" fontSize:17 color:[UIColor whiteColor]];
    [self.contentView addSubview:titleLabel];
    titleLabel.backgroundColor = [UIColor lightGrayColor];
    
    [imgsrcImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.bottom.equalTo(self.contentView);
        make.height.mas_equalTo(126);
    }];
    
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(imgsrcImage);
        
    }];
    
    _imgsrcImage = imgsrcImage;
    _titleLabel = titleLabel;
}


- (void)setModel:(CXLNewListModel *)model {
    _model = model;
    
    [_imgsrcImage sd_setImageWithURL:[NSURL URLWithString:_model.imgsrc]];
    _titleLabel.text = _model.title;
}




@end
